package cn.com.klun.tjy.javaSpider.testss;

import cn.com.klun.tjy.javaSpider.utils.URLFecter;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

public class DfwSpider {


    private static final Logger logger = LoggerFactory.getLogger(DfwSpider.class);

    public static void main(String[] args) throws Exception {
        //初始化一个httpclient
        HttpClient client = new DefaultHttpClient();
        //我们要爬取的一个地址，这里可以从数据库中抽取数据，然后利用循环，可以爬取一个URL队列
        String url="http://quote.eastmoney.com/sh603901.html";
        //抓取的数据
        List<DfwVo> bookdatas= URLFecter.URLParser(client, url);
        //循环输出抓取的数据
        for (DfwVo jd:bookdatas) {
            logger.info("bookID:"+jd.getBookID()+"\t"+"bookPrice:"+jd.getBookPrice()+"\t"+"bookName:"+jd.getBookName());
        }
        //将抓取的数据插入数据库
        //MYSQLControl.executeInsert(bookdatas);

    }


}
